-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace utcnow (and fix style along the way) #199
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For 3.10 support we need to use dt.timezone.utc
.
bin/remove_it.py
Outdated
@@ -231,7 +246,7 @@ def clean_section(pub, section, conf, is_dry_run=True): | |||
kws[key] = int(info[key]) | |||
except KeyError: | |||
pass | |||
ref_time = datetime.utcnow() - timedelta(**kws) | |||
ref_time = dt.datetime.now(dt.UTC) - dt.timedelta(**kws) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dt.UTC
is added in 3.11 so it won't work with Python 3.10 which we support. Until we drop 3.10 we should use dt.timezone.utc
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, fixed
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #199 +/- ##
==========================================
- Coverage 91.28% 91.12% -0.17%
==========================================
Files 26 26
Lines 5417 5406 -11
==========================================
- Hits 4945 4926 -19
- Misses 472 480 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
This PR replaces usages of utcnow in trollmoves.
Ruff wasn't happy about some of the code, so style was modified accordingly.